<div class="container">
     <h2 class="main_title">Manage Finances</h2>
     <div class="def_width_100 f_left"> <?php echo $form->create('Seller', array('action'=>'','method'=>'post','class' => 'mws-form')); ?>
          <div class="paging_gray">
               <div class="pag_ser_div">
                    <select id="_myoLO_SearchTypeSelect" name="searchType">
                         </option>
                         <option selected="" value="DateRange"> Date Range </option>
                    </select>
               </div>
               <div class="pag_ser_div">
                    <select  class="select_count1" id="DateFilter" name="data[Orders][Filter]">
                         <option value="3_d">Last 3 days</option>
                         <option value="7_d" selected="selected">Last 7 days</option>
                         <option value="14_d">Last 14 days</option>
                         <option value="30_d" >Last 7 days</option>
                         <option value="90_d">Last 90 days</option>
                         <option value="180_d">Last 180 days</option>
                         <option value="1_Y">Last 1 Year</option>
                         <option value="2_Y">Year 2 Year</option>
                    </select>
               </div>
               <div class="pag_ser_div1">
                    <input name="" type="submit" value="Search" class="form_btn_2">
               </div>
               <!-- <div class="pag_ser_div"> <a href="#" >Advance Search</a> </div>--> 
          </div>
          <?php echo $form->end(); ?>
          <div class="def_width_100 f_left"></div>
          <div class="def_width_100 f_left">
               <h3 class="mid_title">All Finances placed in the last 7 day(s)</h3>
               <div class="def_width_100 f_left"></div>
               <div class="sell_order_mana">
                    <?php
	  	if(isset($finaces_details) and ($finaces_details))
			{
		  ?>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="grid_table_list">
                         <thead>
                              <tr>
                                   <th width="2%"><input name="" type="checkbox" value=""></th>
                                   <th width="7%">Order Date</th>
                                   <th width="7%">Transaction type</th>
                                   <th width="28%">Order ID/Product Details</th>
                                   <th width="7%">Total Price</th>
                                  
                                   <th width="8%">Marchent Price</th>
                                   <th width="5%">WonderE Commision</th>
                                   <th width="5%">Shipping Status</th>
                                   <th width="8%">Shipped Date</th>
                                   <th width="8%">You Paid on</th>
                                   <th width="8%">Payment Status</th>
                                   <th width="6%">Total </th>
                              </tr>
                         </thead>
                         <tbody>
                              <?php
				  		foreach($finaces_details as $Order)
							{
					  ?>
                              <tr>
                                   <td  width="2%"><input name="" type="checkbox" value="<?php echo $Order['OrderItem']['id'] ; ?>"></td>
                                   <td width="7%"><?php echo date("d-m-Y h:i:s", strtotime($Order['OrderItem']['created'])  ); ?></td>
                                   <td width="7%"><?php 
									if(isset($Order['OrderItem']['id']) and ($Order['OrderItem']['id']))
									  {
										echo "Purchasing";
									  }
                                   ?></td>
                                   <td width="28%" class="text_def_13" style="text-align:left;"><?php 
                                        echo $html->link($Order['OrderItem']['order_tracking_id'], 
                                        array('action'=>'seller_order_detail',$Order['OrderItem']['order_tracking_id'],
										 $Order['OrderItem']['order_Item_Id']),
                                        array('class'=>'brown_link f_left','target'=>'_blank'));?>
                                        <br />
                                        <b> <?php echo $html->link($Order['Product']['name'],
                                        array('controller'=>'products','action'=>'product',
                                        $Order['Product']['slug']),array('class'=>'blue','target'=>'_blank'));
                                        ?> </b> <br/>
                                        <span> <b>QTY:</b><?php echo $Order['OrderItem']['qty']; ?> <br/>
                                        <b>WSIN:</b><?php echo $Order['Product']['wisn']; ?> <br/>
                                        <b>SKU:</b> <?php echo $Order['Product']['MasterProduct']['sku']; ?><br/>
                                        </span></td>
                                   <td width="7%"> $<?php echo ($Order['OrderItem']['qty'])*($Order['OrderItem']['price']); ?></td>
                                   
                                  
                                   <td width="8%">
                                   
                                    <?php 
									
									echo "$".(($Order['Order']['Order']['total_price'])-($Order['Order']['Order']['wondere_price'])); ?>
                                    
                                    
                                    </td>
                                    
                                    
                                     <td width="5%"> 
									 <?php 
									 echo "By: ". $Order['OrderItem']['sell_percentage']."%<br>"; 
									 
									 echo "$".$Order['Order']['Order']['wondere_price']; ?></td>
                                   <td width="5%"><?php
									if(isset($Order['OrderItem']['shipped']) and $Order['OrderItem']['shipped']==1)
										{
											echo "Shipped"; 
										}
									else
										{
										  echo "Unshipped"; 	
										}
							  ?></td>
                                   <td width="8%"><?php
                                          if(isset($Order['OrderItem']['shipped']) and ($Order['OrderItem']['shipped']==1))
                                                {
                                                    echo $Order['OrderItem']['shipping_start_date']; 
                                                   // echo "<br>";
                                                   // echo $Order['OrderItem']['shipping_end_date']; 
                                                }
                                            else
                                                {
                                                  echo "Not Shipped Yet"; 	
                                                }
                                      ?></td>
                                   <td width="8%" class="text_def_11"><?php
                                          if(isset($Order['OrderItem']['shipped']) and ($Order['OrderItem']['shipped']==1))
                                                {
                                                  echo  $next_7_date = _next_dates($Order['OrderItem']['shipping_start_date'], '7','d');
                                                }
                                            else
                                                {
                                                  echo "Please Shipped Soon"; 	
                                                }
                                      ?></td>
                                   <td width="8%"><?php
										if(isset($Order['OrderItem']['bank_code']) and ($Order['OrderItem']['bank_code']))
										{
											echo "Bank Code: <b style=word-wrap:5'>".wordwrap($Order['OrderItem']['bank_code'], 3, "<br />\n").'</b>';
										}
										else
										{
											echo "Not Yet Paid by WonderE";
										}
										
									?></td>
                                   <td width="6%">$<?php echo ($Order['Order']['Order']['total_price'])-($Order['Order']['Order']['wondere_price']); ?></td>
                              </tr>
                              <?php } ?>
                         </tbody>
                    </table>
                    <div class=" paging_gray">
                         <div class="pag_ser_div text_def_13 f_right"> <b>Grand Total</b>: &nbsp;
                          <?php
						  $gt =0; 
				  		foreach($finaces_details as $Order)
							{
								$gt = $gt+($Order['Order']['Order']['total_price'])-($Order['Order']['Order']['wondere_price']);
							}
							?>
                          $<?php echo $gt;  ?> </div>
                    </div>
                    <?php } ?>
               </div>
          </div>
          <div class="pad_10"></div>
     </div>
</div>
